<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <meta>
  <!-- Stylesheets -->
  <link href="../web.css" type="text/css" rel="stylesheet"></link>
  <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link>
  <title>VLFeat - Documentation - C API</title>
  <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>

  <!-- Scripts-->
  
 </meta>

 <!-- Body Start -->
 <body>
  <div id="header">
   <!-- Google CSE Search Box Begins -->
   <form action="http://www.vlfeat.org/search.html" method="get" id="cse-search-box" enctype="application/x-www-form-urlencoded">
    <div>
     <input type="hidden" name="cx" value="003215582122030917471:oq23albfeam"></input>
     <input type="hidden" name="cof" value="FORID:11"></input>
     <input type="hidden" name="ie" value="UTF-8"></input>
     <input type="text" name="q" size="31"></input>
     <input type="submit" name="sa" value="Search"></input>
    </div>
   </form>
   <script src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en" xml:space="preserve" type="text/javascript"></script>
   <!-- Google CSE Search Box Ends -->
   <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1>
  </div>
  <div id="headbanner">
   Documentation - C API
  </div>
  <div id="pagebody">
   <div id="sidebar"> <!-- Navigation Start -->
    <ul>
<li><a href="../index.html">Home</a>
</li>
<li><a href="../download.html">Download</a>
</li>
<li><a href="../doc.html">Documentation</a>
<ul>
<li><a href="../mdoc/mdoc.html">Matlab API</a>
</li>
<li><a href="index.html" class='active' >C API</a>
</li>
<li><a href="../man/man.html">Man pages</a>
</li>
</ul></li>
<li><a href="../overview/tut.html">Tutorials</a>
</li>
<li><a href="../applications/apps.html">Applications</a>
</li>
</ul>

   </div> <!-- sidebar -->
   <div id="content">
    
    <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>
    <div class="doxygen">
<div>
<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">kmeans.c File Reference</div>  </div>
</div>
<div class="contents">

<p>K-means - Declaration.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="kmeans_8h.html">kmeans.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="generic_8h.html">generic.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="mathop_8h.html">mathop.h</a>&quot;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="shuffle-def_8h.html">shuffle-def.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#a77b5f58050110584e188534ad15c1dd0">vl_kmeans_reset</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset state.  <a href="#a77b5f58050110584e188534ad15c1dd0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#a868a729d2ea5b9f9fec15a18e0a27a76">vl_kmeans_new</a> (vl_type dataType, <a class="el" href="mathop_8h.html#aa4cc7d511f708d61bc8fe15c65ad6d74">VlVectorComparisonType</a> distance)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new KMeans object.  <a href="#a868a729d2ea5b9f9fec15a18e0a27a76"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#ae251eb379788d26613057f0014bb15bd">vl_kmeans_new_copy</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> const *kmeans)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new KMeans object by copy.  <a href="#ae251eb379788d26613057f0014bb15bd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#a55a50b06dfd493861651200c61458609">vl_kmeans_delete</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a KMeans object.  <a href="#a55a50b06dfd493861651200c61458609"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#ac86bd2fa181f6e23e22a6ad92f25288c">vl_kmeans_set_centers</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self, void const *centers, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> dimension, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numCenters)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set centers.  <a href="#ac86bd2fa181f6e23e22a6ad92f25288c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#aad205598b82c6f516e68ed889e3fc19a">vl_kmeans_seed_centers_with_rand_data</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self, void const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> dimension, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numData, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numCenters)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Seed centers by randomly sampling data.  <a href="#aad205598b82c6f516e68ed889e3fc19a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#aabb4ba7cf2087e2b8bdafb6d8f80aa06">vl_kmeans_seed_centers_plus_plus</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self, void const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> dimension, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numData, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numCenters)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Seed centers by the KMeans++ algorithm.  <a href="#aabb4ba7cf2087e2b8bdafb6d8f80aa06"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#a3649fe42a94e9b4945511b5665f82355">vl_kmeans_quantize</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self, <a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> *assignments, void *distances, void const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numData)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Quantize data.  <a href="#a3649fe42a94e9b4945511b5665f82355"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#a9fd1885e6b4742a93b4672f56eb9f2ce">vl_kmeans_refine_centers</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self, void const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numData)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Refine center locations.  <a href="#a9fd1885e6b4742a93b4672f56eb9f2ce"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kmeans_8c.html#a3f35fc9b75799b10a6e32ec81a9cd54d">vl_kmeans_cluster</a> (<a class="el" href="structVlKMeans.html">VlKMeans</a> *self, void const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> dimension, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numData, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numCenters)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cluster data.  <a href="#a3f35fc9b75799b10a6e32ec81a9cd54d"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><dl class="author"><dt><b>Author:</b></dt><dd>Andrea Vedaldi </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a3f35fc9b75799b10a6e32ec81a9cd54d"></a><!-- doxytag: member="kmeans.c::vl_kmeans_cluster" ref="a3f35fc9b75799b10a6e32ec81a9cd54d" args="(VlKMeans *self, void const *data, vl_size dimension, vl_size numData, vl_size numCenters)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double vl_kmeans_cluster </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>dimension</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numCenters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object. </td></tr>
    <tr><td class="paramname">data</td><td>data to quantize. </td></tr>
    <tr><td class="paramname">dimension</td><td>data dimension. </td></tr>
    <tr><td class="paramname">numData</td><td>number of data points. </td></tr>
    <tr><td class="paramname">numCenters</td><td>number of clusters. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>K-means energy at the end of optimization.</dd></dl>
<p>The function initializes the centers by using the initialization algorithm set by <a class="el" href="kmeans_8h.html#a7c61513feb74bb5393326ed3cced2650" title="Set K-means initialization algorithm.">vl_kmeans_set_initialization</a> and refines them by the quantization algorithm set by <a class="el" href="kmeans_8h.html#ae2ab27c25bb4730d854219af20f37804" title="Set K-means algorithm.">vl_kmeans_set_algorithm</a>. The process is repeated one or more times (see <a class="el" href="kmeans_8h.html#a7a1095cdba2192ee48e15d19144315fb" title="Set maximum number of repetitions.">vl_kmeans_set_num_repetitions</a>) and the resutl with smaller energy is retained. </p>

</div>
</div>
<a class="anchor" id="a55a50b06dfd493861651200c61458609"></a><!-- doxytag: member="kmeans.c::vl_kmeans_delete" ref="a55a50b06dfd493861651200c61458609" args="(VlKMeans *self)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_kmeans_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object instance.</td></tr>
  </table>
  </dd>
</dl>
<p>The function deletes the KMeans object instance created by <a class="el" href="kmeans_8h.html#a868a729d2ea5b9f9fec15a18e0a27a76" title="Create a new KMeans object.">vl_kmeans_new</a>. </p>

</div>
</div>
<a class="anchor" id="a868a729d2ea5b9f9fec15a18e0a27a76"></a><!-- doxytag: member="kmeans.c::vl_kmeans_new" ref="a868a729d2ea5b9f9fec15a18e0a27a76" args="(vl_type dataType, VlVectorComparisonType distance)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structVlKMeans.html">VlKMeans</a>* vl_kmeans_new </td>
          <td>(</td>
          <td class="paramtype">vl_type&#160;</td>
          <td class="paramname"><em>dataType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="mathop_8h.html#aa4cc7d511f708d61bc8fe15c65ad6d74">VlVectorComparisonType</a>&#160;</td>
          <td class="paramname"><em>distance</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">dataType</td><td>type of data (<a class="el" href="generic_8h.html#aa034d0b942f9800b2a02aeb30ff10fa2">VL_TYPE_FLOAT</a> or <a class="el" href="generic_8h.html#a41d6691dac0cc3648ca9701d27e5d2b0">VL_TYPE_DOUBLE</a>) </td></tr>
    <tr><td class="paramname">distance</td><td>distance. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>new KMeans object instance. </dd></dl>

</div>
</div>
<a class="anchor" id="ae251eb379788d26613057f0014bb15bd"></a><!-- doxytag: member="kmeans.c::vl_kmeans_new_copy" ref="ae251eb379788d26613057f0014bb15bd" args="(VlKMeans const *kmeans)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structVlKMeans.html">VlKMeans</a>* vl_kmeans_new_copy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> const *&#160;</td>
          <td class="paramname"><em>kmeans</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">kmeans</td><td>KMeans object to copy. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>new copy. </dd></dl>

</div>
</div>
<a class="anchor" id="a3649fe42a94e9b4945511b5665f82355"></a><!-- doxytag: member="kmeans.c::vl_kmeans_quantize" ref="a3649fe42a94e9b4945511b5665f82355" args="(VlKMeans *self, vl_uint32 *assignments, void *distances, void const *data, vl_size numData)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_kmeans_quantize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> *&#160;</td>
          <td class="paramname"><em>assignments</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>distances</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object. </td></tr>
    <tr><td class="paramname">assignments</td><td>data to centers assignments. </td></tr>
    <tr><td class="paramname">distances</td><td>data to closes center distance/ </td></tr>
    <tr><td class="paramname">data</td><td>data to quantize. </td></tr>
    <tr><td class="paramname">numData</td><td>number of data points. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9fd1885e6b4742a93b4672f56eb9f2ce"></a><!-- doxytag: member="kmeans.c::vl_kmeans_refine_centers" ref="a9fd1885e6b4742a93b4672f56eb9f2ce" args="(VlKMeans *self, void const *data, vl_size numData)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double vl_kmeans_refine_centers </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object. </td></tr>
    <tr><td class="paramname">data</td><td>data to quantize. </td></tr>
    <tr><td class="paramname">numData</td><td>number of data points. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>K-means energy at the end of optimization.</dd></dl>
<p>The function calls the underlying K-means quantization algorithm (<a class="el" href="kmeans_8h.html#a4c431fed2c5377435e08cbad0040c9f3">VlKMeansAlgorithm</a>) to quantize the specified data <em>data</em>. The function assumes that the cluster centers have already been assigned by using one of the seeding functions, or by setting them. </p>

</div>
</div>
<a class="anchor" id="a77b5f58050110584e188534ad15c1dd0"></a><!-- doxytag: member="kmeans.c::vl_kmeans_reset" ref="a77b5f58050110584e188534ad15c1dd0" args="(VlKMeans *self)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_kmeans_reset </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>The function reset the state of the KMeans object. It deletes any stored centers, releasing the corresponding memory. This cancels the effect of seeding or setting the centers, but does not change the other configuration parameters. </p>

</div>
</div>
<a class="anchor" id="aabb4ba7cf2087e2b8bdafb6d8f80aa06"></a><!-- doxytag: member="kmeans.c::vl_kmeans_seed_centers_plus_plus" ref="aabb4ba7cf2087e2b8bdafb6d8f80aa06" args="(VlKMeans *self, void const *data, vl_size dimension, vl_size numData, vl_size numCenters)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_kmeans_seed_centers_plus_plus </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>dimension</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numCenters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object. </td></tr>
    <tr><td class="paramname">data</td><td>data to sample from. </td></tr>
    <tr><td class="paramname">dimension</td><td>data dimension. </td></tr>
    <tr><td class="paramname">numData</td><td>nmber of data points. </td></tr>
    <tr><td class="paramname">numCenters</td><td>number of centers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aad205598b82c6f516e68ed889e3fc19a"></a><!-- doxytag: member="kmeans.c::vl_kmeans_seed_centers_with_rand_data" ref="aad205598b82c6f516e68ed889e3fc19a" args="(VlKMeans *self, void const *data, vl_size dimension, vl_size numData, vl_size numCenters)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_kmeans_seed_centers_with_rand_data </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>dimension</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numCenters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object. </td></tr>
    <tr><td class="paramname">data</td><td>data to sample from. </td></tr>
    <tr><td class="paramname">dimension</td><td>data dimension. </td></tr>
    <tr><td class="paramname">numData</td><td>nmber of data points. </td></tr>
    <tr><td class="paramname">numCenters</td><td>number of centers.</td></tr>
  </table>
  </dd>
</dl>
<p>The function seeds the KMeans centers by randomly sampling the data <em>data</em>. </p>

</div>
</div>
<a class="anchor" id="ac86bd2fa181f6e23e22a6ad92f25288c"></a><!-- doxytag: member="kmeans.c::vl_kmeans_set_centers" ref="ac86bd2fa181f6e23e22a6ad92f25288c" args="(VlKMeans *self, void const *centers, vl_size dimension, vl_size numCenters)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_kmeans_set_centers </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlKMeans.html">VlKMeans</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void const *&#160;</td>
          <td class="paramname"><em>centers</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>dimension</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numCenters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>KMeans object. </td></tr>
    <tr><td class="paramname">centers</td><td>centers to copy. </td></tr>
    <tr><td class="paramname">dimension</td><td>data dimension. </td></tr>
    <tr><td class="paramname">numCenters</td><td>number of centers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div>
     <!-- Doc Here -->
    </div>
   
   </div>
   <div class="clear">&nbsp;</div>
  </div> <!-- pagebody -->
  <div id="footer">
   &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson
  </div> <!-- footer -->

  <!-- Google Analytics Begins -->
  <script xml:space="preserve" type="text/javascript">
   //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
   document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
   //]]>
  </script>
  <script xml:space="preserve" type="text/javascript">
    //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {

   try {
   var pageTracker = _gat._getTracker("UA-4936091-2");
   pageTracker._trackPageview();
   } catch(err) {}

   }
   //]]>
  </script>
  <!-- Google Analytics Ends -->
 </body>
</html>

 
